/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Test;

import UDPFiles.Base64Tool;
import UDPFiles.UDPDataCmd;
import UDPFiles.UDPFileReader;
import java.io.File;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.json.JSONObject;

/**
 *
 * @author wcss
 */
public class CountShellTime
{
    public static void main(String[] args)
    {
        
        try 
        {
            UDPFileReader ufr = new UDPFileReader(new File("/home/wcss/视频/QvodMovies/aliedit.tar.gz"));
            ufr.open();
            String total = ufr.getFileCode();
            byte[] cnt = ufr.readPack(0);
            ufr.close();
            
             
            long time1 = System.nanoTime()/1000000L;
            System.out.println("time1:" + time1);
            
            UDPDataCmd  udc = UDPDataCmd.makeFileCmd("savedata", total, 500, cnt);
            long time2 = System.nanoTime()/1000000L;
            System.out.println("time2:" + time2);
            
            System.out.println("生成命令对象操作需要：" + (time2-time1) + "毫秒");
            
            JSONObject jsons = JSONObject.fromObject(udc);
            JSONObject small = JSONObject.fromObject(UDPDataCmd.makeControlCmd("save", "data"));
            
            long time3 = System.nanoTime()/1000000L;
            
            jsons.put("cmd", "测试命令");
            String ss = jsons.toString();
            
            long time4 = System.nanoTime()/1000000L;
            //System.out.println(ss);
            
            System.out.println("生成JSON(1K)格式数据操作需要：" + (time4-time3) + "毫秒");
            
            
            long time5 = System.nanoTime()/1000000L;
            
            small.put("cmd", "dfadfasfd");
            small.toString();
                        
            long time6 = System.nanoTime()/1000000L;
            
            System.out.println("生成JSON格式指令操作需要：" + (time5-time6) + "毫秒");
            
        } catch (Exception ex) {
            Logger.getLogger(CountShellTime.class.getName()).log(Level.SEVERE, null, ex);
        }
    }    
}
